package cn.dengta.webapp.user.service;

import java.io.IOException;
import java.util.LinkedList;
import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import cn.dengta.common.web.Page;
import cn.dengta.webapp.user.dto.UserRecDTO;
import cn.dengta.webapp.user.entity.OperateVerifyContent;
import cn.dengta.webapp.user.entity.User;
import cn.dengta.webapp.user.form.query.AnchorQuery;
import cn.dengta.webapp.user.form.query.UserLevelInfoQuery;

/**
 * 用户推荐
 *
 * @author lizhichao
 * @since 2022/9/25
 */
public interface RemoteUserRecService {

	/** 刷新用户层级 */
	void updateUserLevels();

	void updateHeartbeat(Long userId);

	void initForUser(@Nonnull User user, boolean async);

	/**
	 * 查询层级下的用户数
	 */
	Map<Long, Long> findCountByLevel(boolean isOnline, Long... level) throws IOException;

	/**
	 * 查询层级下的用户
	 */
	Page<UserRecDTO> findPageByLevel(UserLevelInfoQuery query, Page<UserRecDTO> page) throws IOException;

	LinkedList<Long> findRec(Long userId, @Nullable AnchorQuery query);

	void updateAuthStatus(Long userId, OperateVerifyContent.OperateVerifyType realAuthType, boolean isPass);

	void updateInviteUserId(Long userId, Long agentId);

	void updateNickname(Long userId, String nickname);

	void updateWeights1(Long userId, boolean weights1);

}
